from __future__ import annotations

from typing import Any, Optional


class ChatError(Exception):
    """Base class for chat domain errors."""

    code = "CHAT_ERROR"

    def __init__(self, message: str, *, details: Optional[Any] = None):
        super().__init__(message)
        self.details = details


class InvalidRequestError(ChatError):
    code = "INVALID_REQUEST"


class SessionNotFoundError(ChatError):
    code = "SESSION_NOT_FOUND"


class RepositoryError(ChatError):
    code = "REPOSITORY_ERROR"


class LLMProviderError(ChatError):
    code = "LLM_PROVIDER_ERROR"


class ToolCallError(ChatError):
    code = "TOOL_CALL_ERROR"
